fully lazy lambda lifting - meaning and definition. What is fully lazy lambda lifting
Diclib.com
ChatGPT AI Dictionary
Enter a word or phrase in any language 👆
Language:

Translation and analysis of words by ChatGPT artificial intelligence

On this page you can get a detailed analysis of a word or phrase, produced by the best artificial intelligence technology to date:

  • how the word is used
  • frequency of use
  • it is used more often in oral or written speech
  • word translation options
  • usage examples (several phrases with translation)
  • etymology

What (who) is fully lazy lambda lifting - definition

META-PROCESS THAT DEFINES FUNCTIONS INDEPENDENTLY OF EACH OTHER IN A GLOBAL SCOPE
Lambda Lifting; Lambda lift; Closure conversion; Λ-lifting

fully lazy lambda lifting      
John Hughes's optimisation of lambda lifting to give {full laziness}. Maximal free expressions are shared to minimise the amount of recalculation. Each inner sub-expression is replaced by a function of its maximal free expressions (expressions not containing any bound variable) applied to those expressions. E.g. f = x . ( y . (+) (sqrt x) y) ((+) (sqrt x)) is a maximal free expression in ( y . (+) (sqrt x) y) so this inner abstraction is replaced with ( g . y . g y) ((+) (sqrt x)) Now, if a partial application of f is shared, the result of evaluating (sqrt x) will also be shared rather than re-evaluated on each application of f. As Chin notes, the same benefit could be achieved without introducing the new higher-order function, g, if we just extracted out (sqrt x). This is similar to the code motion optimisation in procedural languages where constant expressions are moved outside a loop or procedure. (1994-12-01)
closure conversion         
<theory> The transformation of continuation passing style code so that the only free variables of functions are names of other functions. See also Lambda lifting. (1994-12-16)
lambda lifting         
A program transformation to remove free variables. An expression containing a free variable is replaced by a function applied to that variable. E.g. f x = g 3 where g y = y + x x is a free variable of g so it is added as an extra argument: f x = g 3 x where g y x = y + x Functions like this with no free variables are known as supercombinators and are traditionally given upper-case names beginning with "$". This transformation tends to produce many supercombinators of the form f x = g x which can be eliminated by eta reduction and substitution. Changing the order of the parameters may also allow more optimisations. References to global (top-level) constants and functions are not transformed to function parameters though they are technically free variables. A closely related technique is closure conversion. See also Full laziness.

Wikipedia

Lambda lifting

Lambda lifting is a meta-process that restructures a computer program so that functions are defined independently of each other in a global scope. An individual "lift" transforms a local function into a global function. It is a two step process, consisting of;

  • Eliminating free variables in the function by adding parameters.
  • Moving functions from a restricted scope to broader or global scope.

The term "lambda lifting" was first introduced by Thomas Johnsson around 1982 and was historically considered as a mechanism for implementing functional programming languages. It is used in conjunction with other techniques in some modern compilers.

Lambda lifting is not the same as closure conversion. It requires all call sites to be adjusted (adding extra arguments to calls) and does not introduce a closure for the lifted lambda expression. In contrast, closure conversion does not require call sites to be adjusted but does introduce a closure for the lambda expression mapping free variables to values.

The technique may be used on individual functions, in code refactoring, to make a function usable outside the scope in which it was written. Lambda lifts may also be repeated, in order to transform the program. Repeated lifts may be used to convert a program written in lambda calculus into a set of recursive functions, without lambdas. This demonstrates the equivalence of programs written in lambda calculus and programs written as functions. However it does not demonstrate the soundness of lambda calculus for deduction, as the eta reduction used in lambda lifting is the step that introduces cardinality problems into the lambda calculus, because it removes the value from the variable, without first checking that there is only one value that satisfies the conditions on the variable (see Curry's paradox).

Lambda lifting is expensive on processing time for the compiler. An efficient implementation of lambda lifting is O ( n 2 ) {\displaystyle O(n^{2})} on processing time for the compiler.

In the untyped lambda calculus, where the basic types are functions, lifting may change the result of beta reduction of a lambda expression. The resulting functions will have the same meaning, in a mathematical sense, but are not regarded as the same function in the untyped lambda calculus. See also intensional versus extensional equality.

The reverse operation to lambda lifting is lambda dropping.

Lambda dropping may make the compilation of programs quicker for the compiler, and may also increase the efficiency of the resulting program, by reducing the number of parameters, and reducing the size of stack frames. However it makes a function harder to re-use. A dropped function is tied to its context, and can only be used in a different context if it is first lifted.